package dataanalysis;
/*
 * legge i valori delle corrispondenze tra le coppie e ricava 
 * con quanti PLS un FT fa matching per un determinato numero di punti da 1 a 10. 
 * Questo codice prepara tali dati per la visualizzazione del boxplot diagram in R
 * 
 */
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

public class Main2Boxplot {

	public static void main (String[] args)throws Exception{
		String file = "C:\\TableValues.tsv";
		BufferedReader br = new BufferedReader(new FileReader(new File(file)));
		String line ;
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		
		while((line = br.readLine())!=null){
			//System.out.println(line);
			String [] riga = line.split("\t");
			
			for(int i = 0; i < riga.length; i++){
				
				int k = i+1;
				int j = Integer.parseInt(riga[i]);
				map.put(k, j);
				System.out.println(k+","+j);
			}
			
		}br.close();

		/*for (int i : map.keySet()) {
			System.out.println(i);
			System.out.println(map.get(i));
		}*/
		
		printMap(map, "MapValues4.csv");
		
	}
	
	public static void printMap(Map<Integer, Integer>map, String file) throws Exception{
		
		PrintWriter out = new PrintWriter(new FileWriter(file));
		
		for(int i : map.keySet()){
			
			out.print(i+",");
			out.println(map.get(i));
		
		}
		out.close();
	}
}
